//封装接口
//引入二次封装axios
import request from "@/utils/request";
import type { HospitalDetail } from "./type";
import type { DeparmentResponseData, LoginData, UserLoginResponseData, WXlogin, HospitalWordData, DoctorInfoData } from "./type"
enum API {

    HOSPITAL_URL = '/hosp/hospital/',
    //获取某一个医院的科室数据
    HOSPITALDEPARTMENT_URL = '/hosp/hospital/department/',
    //获取验证码数据
    GETUSERCODE_URL = '/sms/send/',
    //用户登录接口
    USERLOGIN_URL = '/user/login/',
    //获取微信扫码登录需要的接口
    WXLOGIN_URL = '/user/weixin/getLoginParam/',
    //获取某一个医院某一个科室的预约挂号数据
    HOSPITALWORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
    //获取医院某个科室某一天医生排版科室
    HOSPITALDOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
    //获取用户信息
    GETUSER_URl = '/user/patient/auth/findAll',
    //获取用户信息
    GETDOCTOR_URL = '/hosp/hospital/getSchedule/'
}
//获取医院详情接口
export const reqHospitalDetail = (hoscode: string) => {
    return request.get<any, HospitalDetail>(API.HOSPITAL_URL + hoscode)
}
//获取医院科室接口
export const reqHospitalDepartment = (hoscode: string) => {
    return request.get<any, DeparmentResponseData>(API.HOSPITALDEPARTMENT_URL + hoscode)
}
//获取验证码
export const reqUSERCODE = (phone: string) => {
    return request.get<any>(API.GETUSERCODE_URL + phone)
}
export const reqLogin = (data: LoginData) => {
    return request.post<any, UserLoginResponseData>(API.USERLOGIN_URL, data)
}
//微信扫码需要登录的参数接口
export const reqWXlogin = (wxRedirectUri: string) => {
    return request.get<any, WXlogin>(API.WXLOGIN_URL + `?wxRedirectUri=${wxRedirectUri}`)
}
//获取预约挂号数据
export const reqHospitalWork = (page: number, limit: number, hoscode: string, depcode: string) => request.get<any, HospitalWordData>(API.HOSPITALWORK_URL + `${page}/${limit}/${hoscode}/${depcode}`);
//获取医院排版数据
export const reqHospitalDoctor = (hoscode: string, depcode: string, workerData: string) => {
    return request.get<any>(API.HOSPITALDOCTOR_URL + `${hoscode}/${depcode}/${workerData}`);
}
//获取就诊人信息
export const reqGetUser = () => {
    return request.get<any, DoctorInfoData>(API.GETUSER_URl)
}
//获取医生信息
export const reqGETDoctor = (doctor: string) => {
    return request.get<any, DoctorInfoData>(API.GETDOCTOR_URL + `/${doctor}`)
}